\documentclass[a4paper,10pt]{memoir}
\usepackage[latin1]{inputenc}
\usepackage[noweb]{ocamlweb}
\usepackage{latexsym}
\usepackage{charter} 
\usepackage[protrusion=true]{microtype}

\chapterstyle{hangnum}
\pagestyle{Ruled}
\input{topcommon.tex}
\begin{document}

% Adjust contents parameters
\setlength{\cftsectionnumwidth}{10mm}
\setlength{\cftpartnumwidth}{8mm}

% Epigraph setup
\epigraphposition{flushright}

\frontmatter

% Title page
\thispagestyle{empty}

\begin{flushright}
\includegraphics{logo.pdf}
\vspace{4mm}

{\sffamily \bfseries \Huge CamlPDF}
\vspace{6mm}

{\Huge A PDF library for Objective Caml}
\vspace{25mm}

{\LARGE John Whitington}
\vspace{2mm}

{\sffamily \bfseries \LARGE Coherent Graphics Ltd}

\end{flushright}

\clearpage

\thispagestyle{empty}

\vspace*{\fill}
\noindent\copyright 2006--2008 Coherent Graphics Limited. Portions \copyright 2006--2008 Coherent Graphics Limited and Xara Group Limited. All rights reserved.

\smallgap
\noindent Adobe, Acrobat, Adobe PDF, Adobe Reader and PostScript are registered trademarks
of Adobe Systems Incorporated.

\smallgap
\noindent The contents of this document are subject to the licence conditions included with the source code, or available by contacting Coherent Graphics Ltd.

% Letter
\cleardoublepage

\chapter*{Request For Comment}

This is a CamlPDF, an OCaml library for reading, writing and manipulating Adobe
portable document files. It is presented as a literate program in the manner of
Knuth. Since this is an implementation of someone else's technology (unlike the
rest of our work, which is new), we have decided to release it as open source
software.

CamlPDF consists of a set of low level modules for representing, reading and
writing the basic structure of PDF together with a higher level API. The
auxiliary libraries Utility, Io, Units and Paper are not directly related to
PDF.

Five examples (Pdfhello, Pdfdecomp, Pdfmerge, Pdfdraft, Pdftest) are provided
(and presented in the appendices of this document).

CamlPDF is released under a BSD licence with special exceptions. See the
LICENCE file in the source for details.

\noindent Please advise of the following:
\begin{itemize}
  \item Files which cannot be read or written, or any other runtime error;
  \item Suggestions as to the extension of the higher level APIs;
  \item Instances of particularly slow or resource-hungry scenarios.
\end{itemize}

Please be aware that PDF is a highly complex format and that many files are
malformed. We will incorporate support for malformed files if Acrobat reads
them.

\smallgap
\smallgap
\smallgap

\noindent John Whitington\\\textit{john@coherentgraphics.co.uk}

\smallgap

\noindent Cambridge, England, November 2007

% Table of contents
\cleardoublepage \tableofcontents

% Introduction
\cleardoublepage

\chapter{Introduction}
This book contains the code and documentation for CamlPDF, a library for
reading, processing and writing Adobe PDF files. It is written using
\emph{ocamlweb}. Documentation (in \LaTeX) is interwoven with code (in
Objective Caml).

This PDF is produced from source by ocamlweb, PDF\LaTeX\ and BibTeX using the
command \texttt{make literate}.

\section{Scope}
This document does not contain the interface files. This information can be
found in the \texttt{ocamldoc}-generated literature supplied. However,
functions which appear in the interface (either fully, or as abstract types)
are indicated by a $\rhd$ in the margin. This also helps to demarcate the
sections of auxiliary functions in the code which lead up to each exposed
function.

Nor does this document contain C files (but you can see the \texttt{external}
declarations which reference them), nor does it contain makefiles and the like.

\section{Order of Reading}

The code is presented in compilation order save for the Utility, IO, Units and
Paper modules which, being of a general nature, are at the end. The
\textsf{Utility} module defines a number of commonly used functions and
redefines a number of functions from \textsf{Pervasives} (including infix
symbols) which are used without comment in the main parts of the program. The
\textsf{Io} module provides for generic input and output to channels and
bytestreams. It is therefore worth familiarising oneself with the appendices
first. The \textsf{Utility} module is a somewhat arbitrary set of common
functions used at Coherent Graphics --- not all functions defined are used in
CamlPDF.

\mainmatter

